package com.example.demo2.controller;

import com.example.demo2.entity.Project;
import com.example.demo2.entity.Standard;
import com.example.demo2.mapper.ProjectMapper;
import com.example.demo2.mapper.StandardMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@CrossOrigin
public class searchController{
        @Autowired
        ProjectMapper projectmapper;
    @Autowired
        StandardMapper standardmapper;
@PostMapping(value = "/searchProject")
public List<Project> SearchProject(@RequestBody String info) {
    System.out.println(info);
    List<Project> retList = new ArrayList<>();
     String query = "%" + info + "%";
    return projectmapper.searchProject(query);
}

@PostMapping(value = "/searchStandard")
    public List<Standard> SearchStandard(@RequestBody String info) {
        System.out.println(info);
        List<Standard> retList = new ArrayList<>();
        String query = "%" + info + "%";
    return standardmapper.searchStandard(query);
}

}